<%@page import="java.util.Iterator"%>
<%@page import="com.service.LiuYan"%>
<%@page import="java.util.ArrayList"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>留言列表</title>
<script type="text/javascript">
	function mydel(id) {
		var a=confirm("确定删除吗？");
		if(a==true){
			location.href="Delete?id="+id;

		}
	}
	function update(id){
		location.href="UpdateServlet?id="+id;
	}
</script>
</head>
<body>
<%
Object data=request.getAttribute("liuyan");
ArrayList<LiuYan> mydata=null;
if(data!=null){
	mydata=(ArrayList<LiuYan>)data;
	Iterator<LiuYan> liuyan=mydata.iterator();
	out.print("<div><span>编号</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span>姓名</span>&nbsp;&nbsp;&nbsp;<span>电话</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span>邮箱</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span>内容</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span>操作</span></div>");
	while(liuyan.hasNext()){
		LiuYan ly=liuyan.next();
		%>
		<div><span><%=ly.getId()%></span>&nbsp;&nbsp;&nbsp;<span><%=ly.getUserName()%></span>&nbsp;&nbsp;&nbsp;<span><%=ly.getTel()%></span>&nbsp;&nbsp;&nbsp;<span><%=ly.getEmail()%></span>&nbsp;&nbsp;&nbsp;<span><%=ly.getContent()%></span>&nbsp;&nbsp;&nbsp;<span>
		<a href="javascript:mydel(<%=ly.getId()%>)">删除</a><a href="javascript:update(<%=ly.getId()%>)">修改</a></span></div>
	<%}	
}
%>

</body>
</html>